(defun find-from-end (x list)
  (declare (optimize (speed 3) (debug 0) (safety 0)))
  (declare (type list list))
  (labels ((aux (x list n)
	     (declare (type fixnum n))
	     (if (= n 1)
		 (when (eq x (car list))
		   (return-from find-from-end x))
		 (let* ((n/2 (ash n -1))
			(half (nthcdr n/2 list)))
		   (aux x half (- n n/2))
		   (aux x list n/2)))))
    (aux x list (length list)))))
